<?php

// 1  验证邮箱 正则  ///23423@baidu.com
$email = "a@sina.com";
$email = "a_@sina.com";

$preg = "/^[A-Za-z0-9]+\w*@([A-Za-z0-9]{1,2}|[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9])(\.[A-Za-z]{2,})+$/";

$c = preg_match($preg,$email);

// var_dump($c);


// 身份证正则
$id = "44581198612251899";

$id = "44528120150825"; //1990-2018  01-12  01-31

$preg = "/^[1-9]\d{5}(19\d{2}|20(0\d|1[0-8]))(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}[\dx]$/i";

$c = preg_match($preg,$id);

// var_dump($c);
// 用户正则，包含 数字 字母 下划线 长度6-8， 不能数字与下划线。  //h564sdf
$username = "zhibin86";

$preg = "/^[a-z]\w{5,7}$/i";

$c = preg_match($preg,$username);

var_dump($c);